from Base import Base
from selenium.webdriver.common.by import By
import time
class Page(Base):
    #输入用户名
    username_loc={By.ID,'use'}
    #输入密码
    password_loc={By.ID,'pwd'}
    #点击登录
    button_loc={By.ID,'log'}
    #点击发布商品
    add_loc={By.XPATH,'/html/body/div[1]/div[1]/button[3]'}
    #点击输入序号
    xuhao_loc={By.XPATH,'/html/body/div[1]/div[2]/div/div/div/form/div[1]/div[2]/div[1]/div/input'}
    #点击输入名称
    name_loc={By.XPATH,'/html/body/div[1]/div[2]/div/div/div/form/div[2]/div[2]/div[1]/div/input'}
    #点击输入开始日期
    start_loc={By.XPATH,'/html/body/div[1]/div[2]/div/div/div/form/div[3]/div[2]/div[1]/div/input'}
    #点击输入结束日期
    end_loc={By.XPATH,'/html/body/div[1]/div[2]/div/div/div/form/div[4]/div[2]/div[1]/div/input'}
    #点击输入状态
    status_loc={By.XPATH,'/html/body/div[1]/div[2]/div/div/div/form/div[5]/div[2]/div[1]/div/input'}


    def login(self):
        self.open_url("http://localhost:8080/")
        time.sleep(5)
        self.send_keys(self.username_loc,'张三')
        time.sleep(5)
        self.send_keys(self.password_loc,'12345678')
        time.sleep(5)
        self.click(self.button_loc)
        time.sleep(5)
        self.send_keys(self.xuhao_loc,'7')
        time.sleep(5)
        self.send_keys(self.name_loc,'火箭')
        time.sleep(5)
        self.send_keys(self.start_loc,'2025-5-15')
        time.sleep(5)
        self.send_keys(self.end_loc,'2025-5-30')
        time.sleep(5)
        self.send_keys(self.status_loc,'进行中')
        time.sleep(5)
